package com.example.order.controller;

import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.product.client.ProductClient;
import com.example.product.common.ProductInfoOutput;

import lombok.extern.slf4j.Slf4j;

@RestController
@RequestMapping("/testproduct")
@Slf4j
public class ClientController {

	@Autowired
	private ProductClient productClient;

	@GetMapping("/getMsgFromProduct")
	public String getMsgFromProduct() {
		return productClient.productMsg();
	}

	@GetMapping("/getProductList")
	public List<ProductInfoOutput> listForOrder() {
		List<ProductInfoOutput> lists = productClient
				.listForOrder(Arrays.asList(new String[] { "157875196366160022" }));
		log.info(lists.toString());
		return lists;
	}
	
	@GetMapping("/costTime")
	public String costTime() {
		return productClient.costTime();
	}

}
